# RUN: llvm-mc -arch=amdgcn -mcpu=gfx908 -disassemble -show-encoding < %s | FileCheck %s

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], s3 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x03]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_add_f32 v255, off, s[8:11], s3 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0xff,0x02,0x03]
0xff,0x0f,0x34,0xe1,0x00,0xff,0x02,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[12:15], s3 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x03,0x03]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x03,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[96:99], s3 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x18,0x03]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x18,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], s101 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x65]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x65

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], m0 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x7c]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x7c

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], 0 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x80]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0x80

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], -1 offset:4095 ; encoding: [0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0xc1]
0xff,0x0f,0x34,0xe1,0x00,0x05,0x02,0xc1

# CHECK: buffer_atomic_add_f32 v5, v0, s[8:11], s3 idxen offset:4095 ; encoding: [0xff,0x2f,0x34,0xe1,0x00,0x05,0x02,0x03]
0xff,0x2f,0x34,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_add_f32 v5, v0, s[8:11], s3 offen offset:4095 ; encoding: [0xff,0x1f,0x34,0xe1,0x00,0x05,0x02,0x03]
0xff,0x1f,0x34,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], s3 ; encoding: [0x00,0x00,0x34,0xe1,0x00,0x05,0x02,0x03]
0x00,0x00,0x34,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], s3 ; encoding: [0x00,0x00,0x34,0xe1,0x00,0x05,0x02,0x03]
0x00,0x00,0x34,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], s3 offset:7 ; encoding: [0x07,0x00,0x34,0xe1,0x00,0x05,0x02,0x03]
0x07,0x00,0x34,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_add_f32 v5, off, s[8:11], s3 offset:4095 slc ; encoding: [0xff,0x0f,0x36,0xe1,0x00,0x05,0x02,0x03]
0xff,0x0f,0x36,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], s3 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x03]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v255, off, s[8:11], s3 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0xff,0x02,0x03]
0xff,0x0f,0x38,0xe1,0x00,0xff,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[12:15], s3 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x03,0x03]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x03,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[96:99], s3 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x18,0x03]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x18,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], s101 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x65]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x65

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], m0 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x7c]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x7c

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], 0 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x80]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0x80

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], -1 offset:4095 ; encoding: [0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0xc1]
0xff,0x0f,0x38,0xe1,0x00,0x05,0x02,0xc1

# CHECK: buffer_atomic_pk_add_f16 v5, v0, s[8:11], s3 idxen offset:4095 ; encoding: [0xff,0x2f,0x38,0xe1,0x00,0x05,0x02,0x03]
0xff,0x2f,0x38,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, v0, s[8:11], s3 offen offset:4095 ; encoding: [0xff,0x1f,0x38,0xe1,0x00,0x05,0x02,0x03]
0xff,0x1f,0x38,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], s3 ; encoding: [0x00,0x00,0x38,0xe1,0x00,0x05,0x02,0x03]
0x00,0x00,0x38,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], s3 ; encoding: [0x00,0x00,0x38,0xe1,0x00,0x05,0x02,0x03]
0x00,0x00,0x38,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], s3 offset:7 ; encoding: [0x07,0x00,0x38,0xe1,0x00,0x05,0x02,0x03]
0x07,0x00,0x38,0xe1,0x00,0x05,0x02,0x03

# CHECK: buffer_atomic_pk_add_f16 v5, off, s[8:11], s3 offset:4095 slc ; encoding: [0xff,0x0f,0x3a,0xe1,0x00,0x05,0x02,0x03]
0xff,0x0f,0x3a,0xe1,0x00,0x05,0x02,0x03

# CHECK: global_atomic_add_f32 v[1:2], v2, off offset:-1 ; encoding: [0xff,0x9f,0x34,0xdd,0x01,0x02,0x7f,0x00]
0xff,0x9f,0x34,0xdd,0x01,0x02,0x7f,0x00

# CHECK: global_atomic_add_f32 v[1:2], v255, off offset:-1 ; encoding: [0xff,0x9f,0x34,0xdd,0x01,0xff,0x7f,0x00]
0xff,0x9f,0x34,0xdd,0x01,0xff,0x7f,0x00

# CHECK: global_atomic_add_f32 v[1:2], v2, off ; encoding: [0x00,0x80,0x34,0xdd,0x01,0x02,0x7f,0x00]
0x00,0x80,0x34,0xdd,0x01,0x02,0x7f,0x00

# CHECK: global_atomic_pk_add_f16 v[1:2], v2, off offset:-1 ; encoding: [0xff,0x9f,0x38,0xdd,0x01,0x02,0x7f,0x00]
0xff,0x9f,0x38,0xdd,0x01,0x02,0x7f,0x00

# CHECK: global_atomic_pk_add_f16 v[1:2], v255, off offset:-1 ; encoding: [0xff,0x9f,0x38,0xdd,0x01,0xff,0x7f,0x00]
0xff,0x9f,0x38,0xdd,0x01,0xff,0x7f,0x00

# CHECK: global_atomic_pk_add_f16 v[1:2], v2, off ; encoding: [0x00,0x80,0x38,0xdd,0x01,0x02,0x7f,0x00]
0x00,0x80,0x38,0xdd,0x01,0x02,0x7f,0x00
